package com.openfire.client.demo.listener;

import org.jivesoftware.smack.ConnectionListener;
import org.jivesoftware.smack.XMPPConnection;

/**
 * openfire 连接监听器
 * 
 * @author wei.ss
 * @date 2016-1-19 上午9:43:51
 * @version 1.0.0 
 * @copyright wonhigh.net.cn 
 */
public class OpenfireConnectionListener implements ConnectionListener {

	@Override
	public void connected(XMPPConnection connection) {
		System.out.println("连接建立成功");
	}

	@Override
	public void authenticated(XMPPConnection connection, boolean resumed) {
		
		System.out.println("授权成功");
	}

	@Override
	public void connectionClosed() {
		
		System.out.println("连接关闭");
	}

	@Override
	public void connectionClosedOnError(Exception e) {
		
		System.out.println("发生异常，关闭链接");
	}

	@Override
	public void reconnectionSuccessful() {
		
		System.out.println("重连成功");
	}

	@Override
	public void reconnectingIn(int seconds) {
		
		System.out.println(seconds + "秒后重连");
	}

	@Override
	public void reconnectionFailed(Exception e) {
		
		System.out.println("重连失败");
	}

}
